package com.xz.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.xz.entity.User;
import com.xz.service.HelloService;

@Controller
public class HelloController {

	@Autowired
	private HelloService helloService;
	
	@ResponseBody
	@RequestMapping(value = "hello")
	public String getName() {
		return helloService.getName();
	}
	
	@ResponseBody
	@RequestMapping(value = "users")
	public List<User> getUsers() {
		return helloService.selectUserAll();
	}
	
	
	@RequestMapping(value = "home")
	public String home(ModelMap mMap) {
		long count = helloService.getUserCount();
		mMap.put("count", count);
		return "home";
	}
	
}
